package com.baiyue;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.CrossOrigin;

import java.util.TimeZone;

/**
 * @author WuBo
 */
@Slf4j
@SpringBootApplication
@CrossOrigin
@EnableScheduling
@EnableAsync
public class ServiceApplication extends SpringBootServletInitializer {
	public static void main(String[] args) {
		TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
		ApplicationContext context = SpringApplication.run(ServiceApplication.class, args);
		String serverPort = context.getEnvironment().getProperty("server.port");
		log.info("InterfaceWuBoApplication started at http://localhost:" + serverPort);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(ServiceApplication.class);
	}

}
